package com.lyf.spring.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//资源路径：类路径+方法路径
@RequestMapping("/user")//类路径（建议都加类路径）/可以不加主要为了规范（只能第一个不加/）

public class UserController {
    //支持get和post@RequestMapping(value = "m2",{method = RequestMethod.GET,method = RequestMethod.POST})
    @RequestMapping("m1")//方法路径
    public String hello() {
        int a = 10;
        return "m";
    }

    @GetMapping("m2")//方法路径
    //支支持get请求
    //等价于@RequestMapping(value = "m2",method = RequestMethod.GET)
    public String m2() {
        int a = 10;
        return "m2";
    }


    @PostMapping("m3")//方法路径
    //只支持post请求
    //等价于@RequestMapping(value = "m3",method = RequestMethod.POST)
    public String m3() {
        int a = 10;
        return "m3";
    }


}
